<html>
<head>
    <script src="/js-test-resources/js-test.js"></script>
    <script type="text/javascript">
    description('This test verifies that XMLHttpRequest properly handles list-valued headers.');
    window.jsTestIsAsync = true;

    var xhr;

    if (window.XMLHttpRequest) {
        xhr = new XMLHttpRequest();
    } else {
        try {
            xhr = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (ex) {
            xhr = new ActiveXObject("Microsoft.XMLHTTP");
        }
    }

    xhr.open("GET", "resources/custom-headers.php");
    xhr.send(null);

    xhr.onreadystatechange = function() {
        if(xhr.readyState == 4) {
            shouldBeGreaterThanOrEqual("xhr.getResponseHeader(\"CONTENT-TYPE\").indexOf(\"text/plain\")", "0");
            shouldBeEqualToString("xhr.getResponseHeader(\"x-custom-header-single\")", "single");
            shouldBeEmptyString("xhr.getResponseHeader(\"x-custom-header-empty\")");
            shouldBeEqualToString("xhr.getResponseHeader(\"x-custom-header-list\")", "one, two");
            finishJSTest();
        }
    }

    </script>
</head>

<body>
</body>
</html>
